package com.rc.saas.mini.service.ugs;

import com.rc.saas.mini.common.constant.WebConstant;
import com.rc.saas.mini.mapper.ugs.TenantUgsLevelDiscountStationMapper;
import com.rc.saas.mini.model.ugs.TenantUgsLevelDiscountStation;
import com.rc.saas.mini.model.ugs.TenantUgsLevelDiscountStationExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author wangzhengwei
 * @create 2021/4/25
 */
@Service
public class TenantUgsLevelDiscountStationServiceImpl implements TenantUgsLevelDiscountStationService {
    @Autowired
    private TenantUgsLevelDiscountStationMapper tenantUgsLevelDiscountStationMapper;

    @Override
    public TenantUgsLevelDiscountStationMapper getMapper() {
        return tenantUgsLevelDiscountStationMapper;
    }

    @Override
    public List<TenantUgsLevelDiscountStation> listByTenantCode(String tenantCode) {
        TenantUgsLevelDiscountStationExample example = new TenantUgsLevelDiscountStationExample();
        example.createCriteria().andTenantCodeEqualTo(tenantCode)
                .andStatusEqualTo(WebConstant.CON0)
                .andBeginTimeLessThanOrEqualTo(new Date())
                .andEndTimeGreaterThanOrEqualTo(new Date());
        return tenantUgsLevelDiscountStationMapper.selectByExample(example);
    }
}
